
package web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import bean.Hotel;
import dao.HDao;
import dao.HDaoimpl;

/**
 * Servlet implementation class ListServlet
 */
@WebServlet("/ListServlet")
public class ListServlet extends HttpServlet {
	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html; charset=UTF-8");
		
		String fname = request.getParameter("fname");
		String cid = request.getParameter("cid");
		HDao h = new HDaoimpl();
		List<Hotel> list = h.list(fname,cid);
		request.setAttribute("list", list);
		request.setAttribute("fname", fname);
		request.setAttribute("cid", cid);
		request.getRequestDispatcher("List.jsp").forward(request, response);
	}

}
